-#
-# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
-# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
-# Created By:
-# Maintained By:
-#

-macro tab(type, type_plural, path, li_class='', meta_kind='')
  %li{ 'class': '{{ li_class }}' }
    %a{ 'href': '##{ prefix }_{{ type_plural|underscore }}', 'data-tab-href': '{{ path }}', 'data-toggle': 'tab', 'data-template' : '/static/mustache/dashboard/object_list.mustache', 'data-object-singular' : "={type|nospace}", 'data-object-plural' : "={type_plural|lower|replace(\" \", \"_\")}" }
      %i{ 'class': 'grcicon-{{ type|lower|nospace }}-color' }
      %span{'class' : '={meta_kind}' } 
        {{ type_plural|title }}
      %span.item-count
      
-endmacro

-set quick_result = quick_result if quick_result is defined else None
-set prefix = "qf" if quick_result else "dash"
-set tabbable_id = '' if quick_result is defined else 'quick_find'

.tabbable.tabs-left{ 'id': "{{ tabbable_id }}" }
  %ul.nav.nav-tabs
    =tab("Control", "Controls", "/search?s=&qr={0}".format(quick_result), "active")
    =tab("Regulation", "Regulations", "/search?quick=true&qr={0}&meta_kind=regulation".format(quick_result))
    =tab("Policy", "Policies", "/search?quick=true&qr={0}&meta_kind=regulation".format(quick_result))
    =tab("Contract", "Contracts", "/search?quick=true&qr={0}&meta_kind=regulation".format(quick_result))
      -#FIXME: Restrict to risk managers
      -#if current_user.can_manage_risk?
    =tab("Risk", "Risks", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Risky Attribute", "Risky Attributes", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Process", "Processes", "/search?quick=true&qr={0}&is_biz_process=true".format(quick_result))
    =tab("System", "Systems", "/search?quick=true&qr={0}&is_biz_process=false".format(quick_result))
    =tab("Org Group", "Org Groups", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Project", "Projects", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Facility", "Facilities", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Product", "Products", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Data Asset", "Data Assets", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Market", "Markets", "/search?quick=true&qr={0}".format(quick_result))
    =tab("Program", "Programs", "/search?quick=true&qr={0}".format(quick_result))

  .tab-content
    .tab-pane.active{ 'id': "{{ prefix }}_controls" }
    .tab-pane{ 'id': "{{ prefix }}_processes" }
    .tab-pane{ 'id': "{{ prefix }}_systems" }
    .tab-pane{ 'id': "{{ prefix }}_products" }
    -#FIXME: Restrict to risk managers
    -#if current_user.can_manage_risk?
    .tab-pane{ 'id': "{{ prefix }}_risks" }
    .tab-pane{ 'id': "{{ prefix }}_attributes" }
    .tab-pane{ 'id': "{{ prefix }}_org_groups" }
    .tab-pane{ 'id': "{{ prefix }}_facilities" }
    .tab-pane{ 'id': "{{ prefix }}_markets" }
    .tab-pane{ 'id': "{{ prefix }}_projects" }
    .tab-pane{ 'id': "{{ prefix }}_data_assets" }
    .tab-pane{ 'id': "{{ prefix }}_regulations" }
    .tab-pane{ 'id': "{{ prefix }}_policies" }
    .tab-pane{ 'id': "{{ prefix }}_contracts" }
    .tab-pane{ 'id': "{{ prefix }}_programs" }

